# encoding:utf-8
# @Author:zhengyi
# @Time:2022/3/10 10:20

import smtplib
from email.mime.text import MIMEText
from email.header import Header


def send_email(receiver, title, text):
    mail_host = 'smtp.sina.com'
    mail_user = 'pythonautotest@sina.com'
    mail_pass = '6b9f84c71f2621fb'
    sender = 'pythonautotest@sina.com'

    message = MIMEText(text)
    message['From'] = Header('pythonautotest@sina.com')
    message['To'] = Header(','.join(receiver), 'utf-8')
    message['Subject'] = Header(title, 'utf-8')
    with smtplib.SMTP_SSL(mail_host, 465) as s:
        s.login(mail_user, mail_pass)
        s.sendmail(sender, receiver, message.as_string())
